package com.redhat.redwork.widget.tree;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;

public class EntityTreeModelImpl implements TreeModel {

	private Log logger = LogFactory.getLog(EntityTreeModelImpl.class);
	
	private String className;
	private String idProperty;
	private String parentProperty;
	private String textProperty;

	@Autowired
	private TreeDataService treeDataService;

	@Override
	public <T extends TreeNode> List<T> loadData(Class<T> clazz,String id, String href)
			throws Exception {

		return treeDataService.loadData(clazz,className,id, parentProperty,idProperty,textProperty,href);
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getIdProperty() {
		return idProperty;
	}

	public void setIdProperty(String idProperty) {
		this.idProperty = idProperty;
	}

	public String getParentProperty() {
		return parentProperty;
	}

	public void setParentProperty(String parentProperty) {
		this.parentProperty = parentProperty;
	}

	public String getTextProperty() {
		return textProperty;
	}

	public void setTextProperty(String textProperty) {
		this.textProperty = textProperty;
	}

	public void setTreeDataService(TreeDataService treeDataService) {
		this.treeDataService = treeDataService;
	}

}
